﻿<%--

1. The best part about Matt's TinyMVC, no ViewState!
Turn if off with the EnableViewState="false" directive

--%>

<%@ Page Language="C#" 
    AutoEventWireup="true"
    CodeBehind="HelloMattsTinyMVC.aspx.cs"
    Inherits="HelloMattsTinyMVC.HelloMattsTinyMVC"
    EnableViewState="false" %>

<%-- 2. Add web application namespace here (optional, makes typing a little easier) --%>
<%@ Import Namespace="HelloMattsTinyMVC" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:ScriptManager runat="server" ID="ScriptManager1" />
        <asp:UpdatePanel runat="server" UpdateMode="Always" ID="UpdatePanel1">
            <ContentTemplate>
                Type something here: 
                
                <%-- 
                    3. Add some data-bound elements      
                --%>

                <%--  This is an example of two-way data binding to the Message
                     property of the HelloMattsTinyMVCController --%>
                <asp:TextBox ID="TextBox1" runat="server"
                    OnDataBinding="RegisterForUpdate"
                    ModelID='<%# Controller.ID %>'
                    ModelPropertyName="Message"
                    Text='<%# ((HelloMattsTinyMVCController)Controller).Message %>' />
                
                <%-- Command binding, when the button is clicked the ProcessMessage() method is called --%>
                <asp:Button ID="Button1" runat="server"
                    Text="Go"
                    OnCommand="ExecuteCommand"
                    ModelID='<%# Controller.ID %>'
                    ModelCommandName="ProcessMessage" />
                
                <br />
                
                <%-- Anywhere on the page, you can display data from the controller. 
                   (Careful: always check for malicious code first! --%>
                <%# ((HelloMattsTinyMVCController)Controller).MessageResponse %>
                             
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>
